﻿<ResourceDictionary xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  
    xmlns:my="clr-namespace:Core.ScreenStore.View"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Style TargetType="my:ArticleDetailsView">
        <Setter Property="ContentProvider" Value="{Binding ContentProvider}"/>
        <Setter Property="Article" Value="{Binding Article}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="my:ArticleDetailsView">
                    <Grid x:Name="LayoutRoot">
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        
                        <Rectangle x:Name="Core"
                                   Stroke="Red"
                                   StrokeThickness="2"
                                   Fill="AliceBlue"
                                   Width="500"
                                   Height="100"
                                   Grid.Row="0">
                        </Rectangle>

                        <TextBox x:Name="Title" Background="Aqua" Width="400" Height="50"
                                 FontFamily="Times New Roman" FontSize="20" Grid.Row="0"/>
                        <StackPanel  x:Name="Content" Grid.Row="1" Width="700" Height="Auto" Margin="1" />
                        <ListBox x:Name="Tags" DataContext="{Binding Article}"  ItemsSource="{Binding Tags}" Grid.Row="2" Height="auto" Width="auto" Margin="1" Background="Cyan">
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Button Height="20" Width="100" Background="Black" Foreground="Wheat"
                                            Command="{Binding ElementName=LayoutRoot, Path=DataContext.SelectTagCommand}"
                                            CommandParameter="{Binding}"
                                            Content="{Binding Name}"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                       
                        <!--<ListBox x:Name="ItemsList" ItemsSource="{Binding Article.Items}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock x:Name="Type" Text="{Binding Type}"/>
                                        <TextBlock x:Name="Value" Text="{Binding Value}" />
                                        
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>-->
                        
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>

                                        <DoubleAnimation Storyboard.TargetName="Content" 
                                                         Storyboard.TargetProperty="Opacity"
                                                         From="1.0" To="0.0" Duration="0:0:1" 
                                                         AutoReverse="True" 
                                                         RepeatBehavior="Forever"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="OtherStates">
                                <VisualState x:Name="Focused">
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="my:ArticlesView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="my:ArticlesView">
                    <StackPanel x:Name="LayoutPanel">
                        <ListBox ItemsSource="{Binding Articles}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <Button Style="{StaticResource button-style}"
                                                Command="{Binding ElementName=LayoutPanel, Path=DataContext.SelectArticleCommand}"
                                                CommandParameter="{Binding}"
                                                Content="{Binding Title}"></Button>
                                        <TextBox Text="{Binding PublishDate}" />
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="my:ThemeSelectView">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="my:ThemeSelectView">
                    <StackPanel x:Name="LayoutPanel">
                        <TextBlock Text="Select a theme"
                                   Style="{StaticResource main-title-style}" />
                        <ListBox ItemsSource="{Binding Themes}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Button Style="{StaticResource button-style}"
                                            Command="{Binding ElementName=LayoutPanel, Path=DataContext.SelectThemeCommand}"
                                            CommandParameter="{Binding}"
                                            Content="{Binding Name}" />
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
